#include<iostream>
#include<math.h>
using namespace std;
int main() {
	int m, n, a, b, c;
	int s[100], i[100];
	cin >> m >> n;
	n = n % m;
	for (a = 0; a < m; a++) {
		cin >> s[a];
	}
	if (n == 0) {
		for (a = 0; a < m - 1; a++) {
			cin >> s[a];
		}
		cout << s[m - 1];
		return 0;
	}

	for (a = m - n; a < m; a++) {
		cout << s[a] << " ";
	}
	for (a = 0; a < m - n - 1; a++) {
		cout << s[a] << " ";
	}
	cout << s[m - n - 1];
	return 0;
}